import request from '@/utils/request.js'

const BASE_URL = 'https://restapi.amap.com/v3/config/district'
const API_KEY = '7a51d0dc140b17c9746552da35f440a3'

// 查询行政区域
export function getArea(param) {
  return request.get(BASE_URL, {
    params: {
      ...param,
      key: API_KEY,
      subdistrict: 1
    }
  })
}

/**
 * 查询天气
 * @param {object} param
 * @returns 天气结果
 */
export function queryWeather(param) {
  return request.get('https://restapi.amap.com/v3/weather/weatherInfo', {
    params: {
      key: API_KEY,
      extensions: 'base',
      ...param
    }
  })
}
